#pragma once

#include <iostream>
#include <unistd.h>
#include <fcntl.h>
#include <cstring>
#include <cerrno>

void printLog()
{
    std::cout << "this is a log" << std::endl;
}
void download()
{
    std::cout << "this is a download" << std::endl;
}
void executeSql()
{
    std::cout << "this is a executeSql" << std::endl;
}
void SetNonBlock(int fd)
{
    int fl = fcntl(fd, F_GETFL);//获取文件描述符当前已有的状态标志位
    if(fl < 0)
    {
        std::cerr << "fcntl : " << strerror(errno) << std::endl;
    }
    fcntl(fd, F_SETFL, fl | O_NONBLOCK);//将已有的flag 和 O_NONBLOCK一起设置回fd中
}